package win.larryzeal.logdemo.service;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import win.larryzeal.logdemo.dao.UserDao;
import win.larryzeal.logdemo.pojo.User;

@Service
public class UserService {
	Logger logger = LoggerFactory.getLogger(UserService.class);

	@Autowired
	private UserDao userDao;

	public User getUserById(Integer id){
		logger.debug("其实没我什么事，单纯为了秀存在感, id = " + id);
		return userDao.getUserById(id);// error if 0 result
	}

	public void saveUser(User user){
		logger.debug("其实没我什么事，单纯为了秀存在感2");
//		userDao.saveUser(user); //TODO:如果是实际生产环境，应该有回调返回生成的id！
		userDao.saveUser2(user); //TODO:如果是实际生产环境，应该有回调返回生成的id！
	}

}
